package zjt.collection1;

import java.util.TreeMap;

public class demo5 {
    public static void main(String[] args) {
        TreeMap treeMap = new TreeMap();
        treeMap.put(new User1(1,"小黑","123456"), 1);
        treeMap.put(new User1(3,"小黑","123456"), 2);
        treeMap.put(new User1(2,"小黑","123456"), 3);
        System.out.println(treeMap);
    }
}
class User1{
    private int id;
    private String name;
    private String age;

    public User1(int id, String name, String age) {
        this.id = id;
        this.name = name;
        this.age = age;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }
}
